package model

import (
	"time"
)

// Detail 模型
type Detail struct {
	Account     int     `gorm:"column:uid"`
	Intro       string  `gorm:"column:intro"`
	Phone       string  `gorm:"column:phone"`
	Gender      int     `gorm:"column:gender"`
	Campus      string  `gorm:"column:campus"`
	Email       string  `gorm:"column:email"`
	BackupEmail string  `gorm:"column:backupemail"`
	Honors      []Honor `gorm:"foreignKey:uid"` // 关联Honors切片
}

// Honor 模型
type Honor struct {
	HonorID   int       `gorm:"primaryKey;autoIncrement;column:id"`
	UserID    int       `gorm:"not null;column:uid"` // 为UserID创建索引以加快查询速度
	Title     string    `gorm:"not null;column:title"`
	StartTime time.Time `gorm:"not null;column:startTime;type:date"`
}

type Apply struct {
	ID             int       `gorm:"primaryKey;autoIncrement;column:id"`
	Apply_ID       int       `gorm:"not null;column:apply_id"`
	UserID         int       `gorm:"not null;column:uid"`
	Kind           int       `gorm:"not null;column:kind"`
	Approval_State int       `gorm:"not null;column:approval_state"`
	Title          string    `gorm:"not null;column:title"`
	ApplyTime      time.Time `gorm:"not null;column:apply_time"`
	Approver1      int       `gorm:"default:null;column:approver1"`
	Approver2      int       `gorm:"default:null;column:approver2"`
	Approver3      int       `gorm:"default:null;column:approver3"`
	ApprovalDate1  time.Time `gorm:"default:null;column:approval_date1"`
	ApprovalDate2  time.Time `gorm:"default:null;column:approval_date2"`
	ApprovalDate3  time.Time `gorm:"default:null;column:approval_date3"`
}

type Apply_to_User struct {
	ID             int
	Apply_ID       int
	UserID         int
	Kind           int
	Approval_State int
	Title          string
	ApplyTime      time.Time
	Approver1_Name string
	Approver2_Name string
	Approver3_Name string
	ApprovalDate1  *time.Time
	ApprovalDate2  *time.Time
	ApprovalDate3  *time.Time
}
type ActivityApply struct {
	ID        int       `gorm:"primaryKey;autoIncrement;column:id"`
	Aid       int       `gorm:"not null;column:Aid"`
	SID       int       `gorm:"not null;column:UID"`
	ApplyTime time.Time `gorm:"not null;column:apply_time"`
	Result    int       `gorm:"default:null;column:result"`
}

type ActivityApplyToUser struct {
	ID            int       `json:"id"`
	Aid           int       `json:"aid"`
	SID           int       `json:"sid"`
	ApplyTime     time.Time `json:"apply_time"`
	StartTime     time.Time `json:"start_time"`
	EndTime       time.Time `json:"end_time"`
	Result        int       `json:"result"`
	ActivityState int       `json:"activity_state"`
	Title         string    `json:"title"`
	Place         string    `json:"place"`
}
